<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>css实现input搜索框展开动画2</title>
  </head>
  <link rel="stylesheet" href="../common.css" />
  <style>
    .btn-box {
      width: auto;
      min-width: 50px;
      height: 50px;
      line-height: 50px;
      border-radius: 25px;
      color: #fff;
      background: linear-gradient(315deg, #6772ff 0, #00f9e5 100%);
      background-size: 104% 104%;
      cursor: pointer;
      position: relative;
    }
    .btn-box span {
      width: 50px;
      height: 50px;
      text-align: center;
      position: absolute;
      top: 0;
      right: 0;
    }
    .btn-box input {
      width: 50px;
      height: 50px;
      padding-left: 20px;
      font-size: 16px;
      font-style: italic;
      text-transform: uppercase;
      letter-spacing: 5px;
      vertical-align: 4px;
      /* 添加过渡效果 */
      transition: all 0.3s ease-in-out;
      /* 设置文字颜色 */
      color: #fff;
    }
    .btn-box:hover input,
    .btn-box input:not(:placeholder-shown) {
      width: 160px;
      padding-right: 50px;
    }
  </style>
  <body>
    <div class="btn-box">
      <span>搜</span>
      <input type="text" placeholder=" " />
    </div>
  </body>
</html>
